import customSettings from '../../config/customSettings';

const EventEmitter = require('wolfy87-eventemitter');

class ProjectUtil {
  static eventDispacher = new EventEmitter();

  static renderPrice(price: number) {
    return `¥${(price / 100).toFixed(2)}`;
  }

  static dispatchCallPhone(phone: string) {
    // console.log('dispatchCallPhone->',phone);
    this.eventDispacher.emitEvent('callPhone', [phone]);
  }

  static enableSoftPhone() {
    const iscrm = customSettings.appName === 'crm';
    let es = iscrm && (!localStorage.getItem('firstInit') || sessionStorage.getItem('createdByMe') === '1');
    console.log('es-->',es);
    return es;
  }
}

export default ProjectUtil;
